/**
 * 2019.12.3 js自主作业
 * 计算阶乘
 */
function calc() {
    var number = parseInt(document.getElementById("num").value);
    var result = document.getElementById("result");
    result.value = f1(number);
}

function f1(n) {
    if (n == 1) {
        return 1;
    } else if (n > 1) {
        return n * f1(n - 1);
    }
}

/**
 * 登陆 验证用户名和密码
 */
function reg() {
    var user = {
        name: "slsher",
        pass: "123456"
    };
    var userName = document.getElementById("name").value;
    var passWord = document.getElementById("pass").value;
    var user2 = {
        name: userName,
        pass: passWord
    };
    console.log(f2(user, user2));

}

function f2(user, user2) {
    if (user.name == user2.name || user.pass == user2.pass) {
        return true;
    } else {
        return false;
    }
}

